package commons.params.ihm;

import java.awt.Color;
import java.awt.event.ActionListener;
import javax.swing.JButton;


public class MyColorButton extends JButton {

	// ParamComponent a prévenir quand l'utilisteur change la couleur
	ActionListener colorChangeListener;

	public MyColorButton() {
	}


	public void setColorchangeListener (ActionListener listener) {
		this.colorChangeListener = listener;
	}


	public void setColor (Color color) {
		if (color==null) {
			//setBackground(Button.);
			javax.swing.UIManager.getDefaults().getColor("Button.background");
			setText("??");
		}
		else {
			setBackground(color);
			setText("R:" + color.getRed() + " G:" + color.getGreen() + " B:" + color.getBlue());
		}

	}

}
